package ar.com.tallerdos.smartdinner.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import ar.com.tallerdos.smartdinner.R;

public class PedidoComentarioActivity extends Activity {    

    public static final String PEDIDO_COMENTARIO = "ar.com.tallerdos.smartdinner.activity.PedidoComentarioActivity.PEDIDO_COMENTARIO";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.agregar_comentario);
	Intent intent = getIntent();

	String comentario = intent.getStringExtra(PEDIDO_COMENTARIO);
	if (comentario == null) {
	    comentario = "";
	}
	
	EditText comentarioEditText = (EditText) findViewById(R.id.comentarioEditText); 
	comentarioEditText.setText(comentario);
    }
    
    public void guardarComentario(View v) {
	Intent returnIntent = new Intent();
	EditText comentarioEditText = (EditText) findViewById(R.id.comentarioEditText); 
	returnIntent.putExtra("result", comentarioEditText.getText().toString());
	setResult(RESULT_OK, returnIntent);
	finish();
    }
}
